package com.pk.platform.business.flow.service.impl;

import java.sql.Blob;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.dom4j.Element;
import org.springframework.stereotype.Service;

import com.globant.jabsorb.JabsorbService;
import com.pk.platform.business.data.service.IBaseDataService;
import com.pk.platform.business.flow.dao.IFlowExecuteDao;
import com.pk.platform.business.flow.service.IFlowExecuteService;
import com.pk.platform.business.flow.vo.SubmitDocVO;
import com.pk.platform.business.privilege.service.IDeptService;
import com.pk.platform.business.privilege.service.IRoleService;
import com.pk.platform.business.privilege.service.IUserService;
import com.pk.platform.domain.BaseBean;
import com.pk.platform.domain.flow.FlowHistory;
import com.pk.platform.domain.flow.FlowStatusHistory;
import com.pk.platform.domain.flow.TableFlowRef;
import com.pk.platform.domain.privilege.Department;
import com.pk.platform.domain.privilege.Role;
import com.pk.platform.domain.privilege.User;
import com.pk.platform.util.DateConverter;
import com.pk.platform.util.StringConverter;
import com.pk.platform.util.XmlUtil;
import com.pk.platform.util.constant.Constant;
import com.pk.platform.util.filter.SystemContext;

@JabsorbService(getAlias="flowExecuteService", getInterface=IFlowExecuteService.class)
@Service
public class FlowExecuteServiceImpl implements IFlowExecuteService {

	private IFlowExecuteDao flowExecuteDao;
	
	private IBaseDataService baseDataService;
	
	private IUserService userService;
	
	private IDeptService deptService;

	private IRoleService roleService;
	
	public TableFlowRef queryTableFlowRefById(String tableName) {
		return flowExecuteDao.get(TableFlowRef.class, tableName);
	}
	
	public void startFlow(BaseBean baseBean)
	{
		String className = baseBean.getClass().getName();
		TableFlowRef tfr = this.queryTableFlowRefById(className);
		if(tfr.getWorkFlow() != null)
		{
			//表单基本信息
			Blob content = tfr.getWorkFlow().getContent();
			String contentStr = StringConverter.blobToString(content);
			XmlUtil xu = new XmlUtil(contentStr);
			Element start = xu.getOneElement("//nodes/node[@nodeAttr='start']");
			User user = SystemContext.getUser();
			baseBean.setCreator(user);
			Date now = new Date();
			baseBean.setLastModifyTime(now);
			baseBean.setRecordTime(now);
			int version = 0;
			int submitVersion = 0;
			baseBean.setVersion(version);
			baseBean.setSubmitVersion(submitVersion);
			baseBean.setNodeId(start.attribute("id").getValue());
			baseBean.setNodeName(start.attribute("name").getValue());
			String status = baseDataService.queryBaseDataById(start.attribute("status").getValue()).getDataValue();
			baseBean.setStatus(status);
			
			//status history
			FlowStatusHistory fsh = new FlowStatusHistory();
			fsh.setTableName(className);
			fsh.setDocId(baseBean.getId());
			fsh.setWorkFlow(tfr.getWorkFlow());
			fsh.setCurrentNodeId(baseBean.getNodeId());
			fsh.setCurrentNodeName(baseBean.getNodeName());
			fsh.setNextNodeId(baseBean.getNodeId());
			fsh.setNextNodeName(baseBean.getNodeName());
			fsh.setAuditorType(Constant.ACTOR_TYPE_MAN);
			fsh.setAuditor(user.getId());
			fsh.setAuditType(Constant.START);
			fsh.setVersion(version);
			fsh.setNodeTime(now);
			fsh.setAchieve(Constant.Y);
			flowExecuteDao.add(fsh);
			
			//personal audit
			FlowHistory fh = new FlowHistory();
			fh.setTableName(className);
			fh.setDocId(baseBean.getId());
			fh.setWorkFlow(tfr.getWorkFlow());
			fh.setCurrentNodeId(baseBean.getNodeId());
			fh.setCurrentNodeName(baseBean.getNodeName());
			fh.setNextNodeId(baseBean.getNodeId());
			fh.setNextNodeName(baseBean.getNodeName());
			fh.setAuditor(user);
			fh.setAuditTime(now);
			fh.setAuditType(Constant.START);
			fh.setVersion(version);
			flowExecuteDao.add(fh);
		}
	}
	
	public String queryActorName(String actorStr)
	{
		StringBuffer result = new StringBuffer();
		String[] actors = actorStr.split(";");
		for(String ax : actors)
		{
			String[] axSplit = ax.split("\\|");
			String id = axSplit[0];
			String type = axSplit[1];
			if(Constant.ACTOR_TYPE_ROLE.equals(type))
			{
				long newId = Long.parseLong(id);
				Role role = roleService.queryRoleById(newId);
				result.append(";").append(role.getRoleName());
			}
			else if(Constant.ACTOR_TYPE_DEPT.equals(type))
			{
				long newId = Long.parseLong(id);
				Department dept = deptService.queryDeptById(newId);
				result.append(";").append(dept.getDeptName());
			}
			else if(Constant.ACTOR_TYPE_MAN.equals(type))
			{
				User user = userService.queryUserById(id);
				result.append(";").append(user.getUsername());
			}
			else if(Constant.ACTOR_TYPE_END.equals(type))
			{
				result.append(";").append(id);
			}
		}
		String names = result.toString();
		if(names.length() > 0)
		{
			names = names.substring(1);
		}
		return names;
	}
	
	public String queryFlowHistory(String tableName, String docId)
	{
		List<Map<String, Object>> list = flowExecuteDao.queryFlowHistory(tableName, docId);
		StringBuffer history = new StringBuffer();
		for(Map<String, Object> his : list)
		{
			String auditor = (String)his.get("username");
			Date auditTime = (Date)his.get("auditTime");
			String time = auditTime == null ? "" : DateConverter.dateToString(auditTime, DateConverter.FORMAT_THREE);
			String auditType = (String)his.get("auditType");
			String opinion = (String)his.get("opinion");
			history.append(auditor).append(" ").append(time).append(" ").append(auditType);
			if(StringConverter.isNotNull(opinion))
			{
				history.append("\n").append("    ").append(opinion);
			}
			history.append("\n\n");
		}
		return history.toString();
	}
	
	public synchronized String submitDoc(SubmitDocVO sdvo)
	{
		TableFlowRef tfr = this.queryTableFlowRefById(sdvo.getTableName());
		if(tfr.getWorkFlow() != null)
		{
			User user = SystemContext.getUser();
			String className = sdvo.getTableName();
			String currentNodeId = sdvo.getCurrentNodeId();
			String docId = sdvo.getDocId();
			String auditorInfo = sdvo.getAuditorInfo();
			String returnBack = sdvo.getReturnBack();
			String opinion = sdvo.getOpinion();
			int version = sdvo.getVersion();
			
			Blob content = tfr.getWorkFlow().getContent();
			String contentStr = StringConverter.blobToString(content);
			XmlUtil xu = new XmlUtil(contentStr);
			Element currentNode = xu.getOneElement("//nodes/node[@id='" + currentNodeId + "']");
			
			String currentNodeName = currentNode.attributeValue("name");
			String conditionType = currentNode.attributeValue("conditionType");
			String percentage = currentNode.attributeValue("percentage");
			Date now = new Date();
			
			BaseBean thisObj = null;
			try
			{
				thisObj = (BaseBean)flowExecuteDao.get(Class.forName(className), docId);
			}
			catch (Exception e) {
				e.printStackTrace();
			}
			int thisSubmitVersion = thisObj.getSubmitVersion();
			if(sdvo.getSubmitVersion() != thisSubmitVersion)
			{
				return StringConverter.resultStr(Constant.FAILURE, "其他审批人员已提交，请刷新页面。");
			}
			thisObj.setSubmitVersion(thisSubmitVersion + 1);
			
			//status history
			FlowStatusHistory fsh = new FlowStatusHistory();
			fsh.setTableName(className);
			fsh.setDocId(docId);
			fsh.setWorkFlow(tfr.getWorkFlow());
			fsh.setNodeTime(now);
			fsh.setCurrentNodeId(currentNodeId);
			fsh.setCurrentNodeName(currentNodeName);
			
			//personal audit
			FlowHistory fh = new FlowHistory();
			fh.setTableName(className);
			fh.setDocId(docId);
			fh.setWorkFlow(tfr.getWorkFlow());
			fh.setAuditTime(now);
			fh.setCurrentNodeId(currentNodeId);
			fh.setCurrentNodeName(currentNodeName);
			fh.setOpinion(opinion);
			
			//如果是或者（随便一个人提交都可以通过）
			if(Constant.OR.equals(conditionType) || !StringConverter.isNotNull(conditionType))
			{
				
				if(Constant.SUBMIT.equals(sdvo.getAuditType()))
				{
					String[] info = auditorInfo.split("\\|");
					String nextAuditor = info[0];
					String nextAuditorType = info[1];
					String nextNodeId = info[2];
					Element nextNode = xu.getOneElement("//nodes/node[@id='" + nextNodeId + "']");
					String nextNodeName = nextNode.attributeValue("name");
					String nextNodeStatus = nextNode.attributeValue("status");
					String nodeAttr = nextNode.attributeValue("nodeAttr");
					String realStatus = baseDataService.queryBaseDataById(nextNodeStatus).getDataValue();
					
					fsh.setNextNodeId(nextNodeId);
					fsh.setNextNodeName(nextNodeName);
					fsh.setAuditor(nextAuditor);
					fsh.setAuditorType(nextAuditorType);
					fsh.setAuditType(Constant.SUBMIT);
					fsh.setVersion(version);
					fsh.setAchieve(Constant.Y);
					
					fh.setNextNodeId(nextNodeId);
					fh.setNextNodeName(nextNodeName);
					fh.setAuditor(user);
					if(Constant.NODE_END.equals(nodeAttr))
					{
						fh.setAuditType("审批完成");
					}
					else
					{
						fh.setAuditType(Constant.SUBMIT);
					}
					fh.setVersion(version);
					
					thisObj.setNodeId(nextNodeId);
					thisObj.setNodeName(nextNodeName);
					thisObj.setStatus(realStatus);
					thisObj.setLastModifyTime(now);
				}
				else if(Constant.RETURN.equals(sdvo.getAuditType()))
				{
					int newVersion = version + 1;
					FlowStatusHistory status = flowExecuteDao.get(FlowStatusHistory.class, returnBack);
					fsh.setNextNodeId(status.getNextNodeId());
					fsh.setNextNodeName(status.getNextNodeName());
					fsh.setAuditor(status.getAuditor());
					fsh.setAuditorType(status.getAuditorType());
					fsh.setAuditType(Constant.RETURN);
					fsh.setVersion(newVersion);
					fsh.setAchieve(Constant.Y);
					
					fh.setNextNodeId(status.getNextNodeId());
					fh.setNextNodeName(status.getNextNodeName());
					fh.setAuditor(user);
					fh.setAuditType(Constant.RETURN);
					fh.setVersion(newVersion);
					
					Element returnNode = xu.getOneElement("//nodes/node[@id='" + status.getNextNodeId() + "']");
					String returnNodeName = returnNode.attributeValue("name");
					String returnNodeStatus = returnNode.attributeValue("status");
					String realStatus = baseDataService.queryBaseDataById(returnNodeStatus).getDataValue();
					thisObj.setNodeId(status.getNextNodeId());
					thisObj.setNodeName(returnNodeName);
					thisObj.setStatus(realStatus);
					thisObj.setVersion(newVersion);
					thisObj.setLastModifyTime(now);
				}
				flowExecuteDao.add(fsh);
				flowExecuteDao.add(fh);
			}
			//需要多人确认
			else if(Constant.AND.equals(conditionType) || Constant.PERCENTAGE.equals(conditionType))
			{
				if(Constant.SUBMIT.equals(sdvo.getAuditType()))
				{
					String[] info = auditorInfo.split("\\|");
					String nextAuditor = info[0];
					String nextAuditorType = info[1];
					String nextNodeId = info[2];
					Element nextNode = xu.getOneElement("//nodes/node[@id='" + nextNodeId + "']");
					String nextNodeName = nextNode.attributeValue("name");
					String nextNodeStatus = nextNode.attributeValue("status");
					String nodeAttr = nextNode.attributeValue("nodeAttr");
					String realStatus = baseDataService.queryBaseDataById(nextNodeStatus).getDataValue();
					
					if(this.isTheSameStatus(className, docId)) //还未有人提交
					{
						fsh.setNextNodeId(nextNodeId);
						fsh.setNextNodeName(nextNodeName);
						fsh.setAuditor(nextAuditor);
						fsh.setAuditorType(nextAuditorType);
						fsh.setAuditType(Constant.SUBMIT);
						fsh.setVersion(version);
						fsh.setAchieve(Constant.N);
						flowExecuteDao.add(fsh);
					}
					else
					{
						Map<String, Object> lastStatus = this.queryLastStatusHistory(className, docId);
						String id = lastStatus.get("id").toString();
						fsh = flowExecuteDao.get(FlowStatusHistory.class, id);
					}
					
					fh.setNextNodeId(nextNodeId);
					fh.setNextNodeName(nextNodeName);
					fh.setAuditor(user);
					if(Constant.NODE_END.equals(nodeAttr))
					{
						fh.setAuditType("审批完成");
					}
					else
					{
						fh.setAuditType(Constant.SUBMIT);
					}
					fh.setVersion(version);
					flowExecuteDao.add(fh);
					
					flowExecuteDao.getHibernateSession().flush();
					thisObj.setLastModifyTime(now);
					int throughCount = flowExecuteDao.queryThroughCount(className, docId, currentNodeId, version);
					Map<String, Object> currentStatus = flowExecuteDao.queryCurrentStatus(className, docId, currentNodeId, version);
					String currentStatusAuditor = currentStatus.get("auditor").toString();
					String currentStatusAuditorType = currentStatus.get("auditorType").toString();
					String currentStatusAuditorInfo = currentStatusAuditor + "|" + currentStatusAuditorType;
					String assignToUserStr = this.queryAssignToUser(currentStatusAuditorInfo);
					String[] users = assignToUserStr.split(";");
					
					if(Constant.AND.equals(conditionType))
					{
						if(throughCount >= users.length)
						{
							fsh.setAchieve(Constant.Y);
							thisObj.setNodeId(nextNodeId);
							thisObj.setNodeName(nextNodeName);
							thisObj.setStatus(realStatus);
						}
					}
					else if(Constant.PERCENTAGE.equals(conditionType))
					{
						Double realPercentage = 1.0;
						Double definePercentage = 1.0;
						if(users.length != 0)
						{
							realPercentage = ((double)throughCount) / ((double)users.length);
							definePercentage = Double.parseDouble(percentage);
						}
						if(realPercentage >= definePercentage)
						{
							fsh.setAchieve(Constant.Y);
							thisObj.setNodeId(nextNodeId);
							thisObj.setNodeName(nextNodeName);
							thisObj.setStatus(realStatus);
						}
					}
				}
				else if(Constant.RETURN.equals(sdvo.getAuditType()))
				{
					int newVersion = version + 1;
					FlowStatusHistory status = flowExecuteDao.get(FlowStatusHistory.class, returnBack);
					if(this.isTheSameStatus(className, docId)) //还未有人提交
					{
						fsh.setNextNodeId(status.getNextNodeId());
						fsh.setNextNodeName(status.getNextNodeName());
						fsh.setAuditor(status.getAuditor());
						fsh.setAuditorType(status.getAuditorType());
						fsh.setAuditType(Constant.RETURN);
						fsh.setVersion(newVersion);
						fsh.setAchieve(Constant.Y);
						flowExecuteDao.add(fsh);
					}
					else
					{
						Map<String, Object> lastStatus = this.queryLastStatusHistory(className, docId);
						String id = lastStatus.get("id").toString();
						FlowStatusHistory lastSH = flowExecuteDao.get(FlowStatusHistory.class, id);
						lastSH.setNextNodeId(status.getNextNodeId());
						lastSH.setNextNodeName(status.getNextNodeName());
						lastSH.setAuditor(status.getAuditor());
						lastSH.setAuditorType(status.getAuditorType());
						lastSH.setAuditType(Constant.RETURN);
						lastSH.setVersion(newVersion);
						lastSH.setAchieve(Constant.Y);
					}
					
					fh.setNextNodeId(status.getNextNodeId());
					fh.setNextNodeName(status.getNextNodeName());
					fh.setAuditor(user);
					fh.setAuditType(Constant.RETURN);
					fh.setVersion(newVersion);
					flowExecuteDao.add(fh);
					
					Element returnNode = xu.getOneElement("//nodes/node[@id='" + status.getNextNodeId() + "']");
					String returnNodeName = returnNode.attributeValue("name");
					String returnNodeStatus = returnNode.attributeValue("status");
					String realStatus = baseDataService.queryBaseDataById(returnNodeStatus).getDataValue();
					thisObj.setNodeId(status.getNextNodeId());
					thisObj.setNodeName(returnNodeName);
					thisObj.setStatus(realStatus);
					thisObj.setVersion(newVersion);
					thisObj.setLastModifyTime(now);
				}
			}
		}
		return StringConverter.resultStr(Constant.SUCCESS, "");
	}
	
	public List<Map<String, Object>> queryFlowStatusHistory(String tableName, String docId)
	{
		List<Map<String, Object>> list = flowExecuteDao.queryFlowStatusHistory(tableName, docId, false);
		int len = list.size();
		List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
		
		BaseBean thisObj = null;
		try
		{
			thisObj = (BaseBean)flowExecuteDao.get(Class.forName(tableName), docId);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		
		int n = 0;
		for(int i = 0; i < len; i++)
		{
			Map<String, Object> status = list.get(i);
			String currentNodeId = status.get("nextNodeId").toString();
			if(currentNodeId.equals(thisObj.getNodeId()))
			{
				n = i;
				break;
			}
		}
		
		for(int i = n; i < len; i++)
		{
			Map<String, Object> status = list.get(i);
			if(i == n && !this.isTheSameStatus(tableName, docId))
			{
				result.add(status);
			}
			String currentNodeId = status.get("currentNodeId").toString();
			for(int j = i + 1; j < len; j++)
			{
				Map<String, Object> nextStatus = list.get(j);
				String nextNodeId = nextStatus.get("nextNodeId").toString();
				if(currentNodeId.equals(nextNodeId))
				{
					if(!thisObj.getNodeId().equals(nextNodeId))
					{
						result.add(nextStatus);
					}
					i = j - 1;
					break;
				}
			}
		}
		return result;
	}
	
	public void delRelativeHistory(String tableName, String docId)
	{
		flowExecuteDao.delFlowHistory(tableName, docId);
		flowExecuteDao.delFlowStatusHistory(tableName, docId);
	}
	
	public boolean startIsAuditor(String auditorInfo)
	{
		return this.isAuditor(auditorInfo);
	}
	
	public boolean taskIsAuditor(String tableName, String docId)
	{
		BaseBean thisObj = null;
		try
		{
			thisObj = (BaseBean)flowExecuteDao.get(Class.forName(tableName), docId);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		
		boolean hasSubmit = flowExecuteDao.hasSubmit(tableName, docId, thisObj.getNodeId(), thisObj.getVersion());
		boolean theSameStatus = this.isTheSameStatus(tableName, docId);
		if(hasSubmit && !theSameStatus)
		{
			return false;
		}
		
		List<Map<String, Object>> list = flowExecuteDao.queryFlowStatusHistory(tableName, docId, true);
		Map<String, Object> status = null;
		for(Map<String, Object> map : list)
		{
			String toNodeId = map.get("nextNodeId").toString();
			if(toNodeId.equals(thisObj.getNodeId()))
			{
				status = map;
				break;
			}
		}
		boolean flag = false;
		if(list.size() > 0)
		{
			String id = status.get("auditor").toString();
			String type = status.get("auditorType").toString();
			String auditorInfo = id + "|" + type;
			flag = this.isAuditor(auditorInfo);
		}
		return flag;
	}
	
	public String queryAssignToUser(String auditorInfo)
	{
		StringBuffer result = new StringBuffer();
		String[] auditors = auditorInfo.split(";");
		for(String ax : auditors)
		{
			String[] info = ax.split("\\|");
			String id = info[0];
			String type = info[1];
			if(Constant.ACTOR_TYPE_ROLE.equals(type))
			{
				long newId = Long.parseLong(id);
				Role role = roleService.queryRoleById(newId);
				Set<User> userSet = role.getEffectiveUser();
				for(User user : userSet)
				{
					result.append(";").append(user.getId()).append("|").append(Constant.ACTOR_TYPE_MAN);
				}
			}
			else if(Constant.ACTOR_TYPE_DEPT.equals(type))
			{
				long newId = Long.parseLong(id);
				Department dept = deptService.queryDeptById(newId);
				Set<User> userSet = dept.getEffectiveUser();
				for(User user : userSet)
				{
					result.append(";").append(user.getId()).append("|").append(Constant.ACTOR_TYPE_MAN);
				}
			}
			else if(Constant.ACTOR_TYPE_MAN.equals(type))
			{
				result.append(";").append(id).append("|").append(Constant.ACTOR_TYPE_MAN);
			}
		}
		String str = result.toString();
		if(StringConverter.isNotNull(str))
		{
			str = str.substring(1);
		}
		return str;
	}
	
	public String queryTheSameAuditor(String tableName, String docId)
	{
		String result = "{'same':'#SAME#', 'auditor':'#AUDITOR#', 'next':'#NEXT#', 'nextname':'#NEXTNAME#'}";
		Map<String, Object> lastStatus = this.queryLastStatusHistory(tableName, docId);
		boolean flag = this.isTheSameStatus(tableName, docId);
		if(!flag)
		{
			String nextAuditor = lastStatus.get("auditor").toString();
			String nextAuditorType = lastStatus.get("auditorType").toString();
			String nextNodeId = lastStatus.get("nextNodeId").toString();
			String nextNodeName = lastStatus.get("nextNodeName").toString();
			result = result.replace("#SAME#", Constant.N);
			result = result.replace("#AUDITOR#", nextAuditor + "|" + nextAuditorType);
			result = result.replace("#NEXT#", nextNodeId);
			result = result.replace("#NEXTNAME#", nextNodeName);
		}
		else
		{
			result = result.replace("#SAME#", Constant.Y);
			result = result.replace("#AUDITOR#", "");
			result = result.replace("#NEXT#", "");
			result = result.replace("#NEXTNAME#", "");
		}
		return result;
	}
	
	public List<Map<String, Object>> queryDistinctFlowStatusSubmit(String tableName, String docId)
	{
		return flowExecuteDao.queryDistinctFlowStatusSubmit(tableName, docId);
	}
	
	private boolean isTheSameStatus(String tableName, String docId)
	{
		BaseBean thisObj = null;
		boolean flag = true;
		try
		{
			thisObj = (BaseBean)flowExecuteDao.get(Class.forName(tableName), docId);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		Map<String, Object> lastStatus = this.queryLastStatusHistory(tableName, docId);
		String nextNodeId = lastStatus.get("nextNodeId").toString();
		if(!thisObj.getNodeId().equals(nextNodeId))
		{
			flag = false;
		}
		return flag;
	}
	
	private boolean isAuditor(String auditorInfo)
	{
		boolean flag = false;
		if(!StringConverter.isNotNull(auditorInfo))
			return flag;
		String[] auditors = auditorInfo.split(";");
		User user = SystemContext.getUser();
		user = userService.queryUserById(user.getId());
		for(String ax : auditors)
		{
			String[] info = ax.split("\\|");
			String id = info[0];
			String type = info[1];
			if(Constant.ACTOR_TYPE_ROLE.equals(type))
			{
				long newId = Long.parseLong(id);
				Set<Role> roleSet = user.getRoleSet();
				for(Role role : roleSet)
				{
					if(newId == role.getId())
					{
						flag = true;
						return flag;
					}
				}
			}
			else if(Constant.ACTOR_TYPE_DEPT.equals(type))
			{
				long newId = Long.parseLong(id);
				Department dept = user.getDept();
				if(dept != null && newId == dept.getId())
				{
					flag = true;
					return flag;
				}
			}
			else if(Constant.ACTOR_TYPE_MAN.equals(type))
			{
				if(id.equals(user.getId()))
				{
					flag = true;
					return flag;
				}
			}
		}
		return flag;
	}
	
	private Map<String, Object> queryLastStatusHistory(String tableName, String docId)
	{
		List<Map<String, Object>> list = flowExecuteDao.queryFlowStatusHistory(tableName, docId, true);
		if(list.size() > 0)
			return list.get(0);
		return null;
	}

	public IFlowExecuteDao getFlowExecuteDao() {
		return flowExecuteDao;
	}

	public void setFlowExecuteDao(IFlowExecuteDao flowExecuteDao) {
		this.flowExecuteDao = flowExecuteDao;
	}

	public IBaseDataService getBaseDataService() {
		return baseDataService;
	}

	public void setBaseDataService(IBaseDataService baseDataService) {
		this.baseDataService = baseDataService;
	}

	public IUserService getUserService() {
		return userService;
	}

	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	public IDeptService getDeptService() {
		return deptService;
	}

	public void setDeptService(IDeptService deptService) {
		this.deptService = deptService;
	}

	public IRoleService getRoleService() {
		return roleService;
	}

	public void setRoleService(IRoleService roleService) {
		this.roleService = roleService;
	}

}
